(:: pragma bea:global-element-parameter parameter="$getUbigeoByIdResponse1" element="ns0:getUbigeoByIdResponse" location="WS_Ubigeo_schema1.xsd" ::)
(:: pragma bea:global-element-return element="ns2:getUbigeoByIdResponse" location="GetUbigeoProxy.wsdl" ::)

declare namespace ns2 = "http://xmlns.nextel.com/GetUbigeoProxy/";
declare namespace ns1 = "http://xmlns.nextel.com/EP";
declare namespace ns0 = "http://ws.ubigeo.nextel.com.pe/";
declare namespace xf = "http://tempuri.org/CrmIntegration_SB/GetUbigeo/outputTransform/";

declare function xf:outputTransform($getUbigeoByIdResponse1 as element(ns0:getUbigeoByIdResponse),
    $id as xs:string)
    as element(ns2:getUbigeoByIdResponse) {
        <ns2:getUbigeoByIdResponse>
            <audit>
                <ns1:msgId>{ $id }</ns1:msgId>
                {
                    for $errorCode in $getUbigeoByIdResponse1/return/errorCode
                    return
                        <ns1:errorCode>{ data($errorCode) }</ns1:errorCode>
                }
                {
                    for $errorMsg in $getUbigeoByIdResponse1/return/errorMsg
                    return
                        <ns1:errorMsg>{ data($errorMsg) }</ns1:errorMsg>
                }
            </audit>
            <objUbigeo>
                {
                    for $ubigeoId in $getUbigeoByIdResponse1/return/objUbigeo/ubigeoId
                    return
                        <ubigeoId>{ data($ubigeoId) }</ubigeoId>
                }
                {
                    for $regionId in $getUbigeoByIdResponse1/return/objUbigeo/regionId
                    return
                        <regionId>{ data($regionId) }</regionId>
                }
                {
                    for $nombre in $getUbigeoByIdResponse1/return/objUbigeo/nombre
                    return
                        <nombre>{ data($nombre) }</nombre>
                }
                {
                    for $dep in $getUbigeoByIdResponse1/return/objUbigeo/dep
                    return
                        <dep>{ data($dep) }</dep>
                }
                {
                    for $prov in $getUbigeoByIdResponse1/return/objUbigeo/prov
                    return
                        <prov>{ data($prov) }</prov>
                }
                {
                    for $dist in $getUbigeoByIdResponse1/return/objUbigeo/dist
                    return
                        <dist>{ data($dist) }</dist>
                }
                {
                    for $areaCode in $getUbigeoByIdResponse1/return/objUbigeo/areaCode
                    return
                        <areaCode>{ data($areaCode) }</areaCode>
                }
            </objUbigeo>
        </ns2:getUbigeoByIdResponse>
};

declare variable $getUbigeoByIdResponse1 as element(ns0:getUbigeoByIdResponse) external;
declare variable $id as xs:string external;

xf:outputTransform($getUbigeoByIdResponse1,
    $id)
